@extends('layouts.admin')
@section('title')
    <title>article添加</title>
@endsection
@section('content')
    @include('layouts.left')
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
               article添加
                <small>Control panel</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li class="active">Dashboard</li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-offset-2 col-md-8">
                    @if(session('info'))
                        <div class="alert alert-warning alert-dismissible">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <h4><i class="icon fa fa-warning"></i> Alert!</h4>
                            {{ session('info') }}
                        </div>
                    @endif
                    @if(count($errors)>0)
                    <div class="alert alert-danger alert-dismissible">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        <h4><i class="icon fa fa-ban"></i> 警告</h4>
                        <ul>
                            @foreach($errors -> all() as $error)
                                <li >{{ $error }}</li>
                            @endforeach
                        </ul>
                    </div>
                    @endif
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速添加</h3>
                        </div>
                        <!-- /.box-header -->
                        <!-- form start -->
                       <form  action="{{ url('article') }}" method="post" enctype="multipart/form-data">
                            {{ csrf_field() }}
                            <div class="box-body">
                                <div class="form-group">
                                    <label>分类</label>
                                    <select class="form-control" name="typeid" >
                                        @foreach($datas as $data)
                                            <option value="{{ $data -> typeid }}">{{ $data -> typename }}</option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">置顶等级</label>
                                    <select class="form-control" name="istop" >
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">标题</label>
                                    <input type="text" class="form-control"  required name="title" value="{{old('title')}}"placeholder="标题" >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">关键字</label>
                                    <input type="text" class="form-control"   name="keyword" value="{{old('keyword')}}"  placeholder="关键字,用逗号隔开">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">是否是广告</label>
                                    <select class="form-control" name="isadd" >
                                        <option value="1">是</option>
                                        <option value="0">不是</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">封面图片</label>
                                    <input type="file" class="form-control"   name="coverpic" required value="{{old('coverpic')}}"placeholder="封面图片" >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">描述</label>
                                    <input type="text" class="form-control"  required name="description" value="{{old('description')}}"  placeholder="请填写封面处描述">
                                </div>
                                 <div class="form-group">
                                    <label for="exampleInputEmail1">排序</label>
                                    <input type="text" class="form-control"  required name="sort" value="{{old('sort')}}"  placeholder="排序">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">状态</label>
                                    <select class="form-control" name="status" >
                                        <option value="1">正常</option>
                                        <option value="0">禁用</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail">内容</label>
                                    <script id="container" name="content" type="text/plain" value="{{old('content')}}">//在这里输入内容</script>
                                    <script type="text/javascript" src="{{asset('ueditor/ueditor.config.js')}}"></script>
                                    <script type="text/javascript" src="{{asset('ueditor/ueditor.all.min.js')}}"></script>
                                    <!-- 实例化编辑器 -->
                                    <script type="text/javascript">
                                        var ue = UE.getEditor('container');
                                    </script>
                                </div>
                            <!-- /.box-body -->
                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">提交</button>
                            </div>
                        </form>
                    </div>
                    <!-- /.box -->
                </div>
                <!--/.col (left) -->
            </div>
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <!-- 在这里 写js函数start-->
    <script>
        $(function () {

            //Date range picker
            $('#reservation').daterangepicker()
            //Date range picker with time picker
            $('#reservationtime').daterangepicker({ timePicker: true, timePickerIncrement: 30, format: 'MM/DD/YYYY h:mm A' })
            //Date range as a button
            $('#daterange-btn').daterangepicker(
                {
                    ranges   : {
                        'Today'       : [moment(), moment()],
                        'Yesterday'   : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                        'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
                        'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                        'This Month'  : [moment().startOf('month'), moment().endOf('month')],
                        'Last Month'  : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
                    },
                    startDate: moment().subtract(29, 'days'),
                    endDate  : moment()
                },
                function (start, end) {
                    $('#daterange-btn span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
                }
            )

            //Date picker
            $('#datepicker').datepicker({
                autoclose: true
            })

        })
    </script>

    <!--在这里  写js函数end-->
@endsection


